import fatch from './index'

const apiServe = {
	getSwiper: params => {
		// 轮播图信息
		return fatch({
			method: 'get',
			url: '/home/swiper',
		})
	},
	getGroup: params => {
		// 小组信息
		return fatch({
			method: 'get',
			url: '/home/groups',
		})
	},
	getNews: params => {
		return fatch({
			method: 'get',
			url: '/home/news',
		})
	},
	getHouses: params => {
		return fatch({
			method: 'get',
			url: '/houses',
			data: params,
		})
	},
	getlogin: params => {
		// 登录接口
		return fatch({
			method: 'post',
			url: '/user/login',
			data: params,
		})
	},
	setRegister: params => {
		// 注册接口
		return fatch({
			method: 'post',
			url: '/user/registered',
			data: params,
		})
	},
	getUserinfo: params => {
		// 获取用户信息接口
		return fatch({
			method: 'get',
			url: '/user',
			data: params,
		})
	},
	gethouseInof: id => {
		// 获取房屋详情
		return fatch({
			method: 'get',
			url: `/houses/${id}`,
		})
	},
	// 获取房屋是否收藏
	gethousesc: id => {
		return fatch({
			method: 'get',
			url: `/user/favorites/${id}`,
		})
	},
	// 收藏房屋
	getCollection: id => {
		return fatch({
			method: 'post',
			url: `/user/favorites/${id}`,
		})
	},
	// 删除收藏房屋
	getdelete: id => {
		return fatch({
			method: 'delete',
			url: `/user/favorites/${id}`,
		})
	},
} 

export const https = 'http://localhost:5001'

export default  apiServe